<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        function dui(flag = true) {
            if (flag == true) {
                let arr = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
                let box = ''
                for (let i = 0; i < 6; i++) {
                    box += arr[Math.floor(Math.random() * 15)]
                }
                return document.write(`
                                <div style="width: 600px;
                                height: 600px; margin: 50px auto; background-color: #${box};">
                                </div>
                            `)
            } else {
                let r1 = Math.floor(Math.random() * 256)
                let r2 = Math.floor(Math.random() * 256)
                let r3 = Math.floor(Math.random() * 256)
                return document.write(`
                                <div style="width: 600px;
                                height: 600px; margin: 50px auto; background-color: rgb(${r1},${r2},${r3});">
                                </div>
                            `)
            }
        }
        dui(false)
    </script>
</body>

</html>